﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Yto.Common.Time
{
    public class LocalTimeProvider : ITimeProvider
    {
        public DateTime Now => DateTime.Now;

        public DateTimeKind Kind => DateTimeKind.Local;

        public bool IsMultipleTimezone => false;

        public DateTime Standardize(DateTime dateTime)
        {
            if (dateTime.Kind == DateTimeKind.Unspecified)
            {
                return DateTime.SpecifyKind(dateTime, DateTimeKind.Local);
            }
            if (dateTime.Kind == DateTimeKind.Local)
            {
                return dateTime.ToLocalTime();
            }
            return dateTime;
        }
        internal LocalTimeProvider() { }
    }
}
